FlowLayout does the best it can, and puts the components on top of each other. If the frame is not wide enough, the text field will be truncated.
JTextField
A JTextField
is a Swing component,
so there must be a listener object
for it to be useful.
After entering text, the user hits the enter key.
This generates an ActionEvent
just like
clicking on a button.
The listener needs to get
the text and do something with it.
To get text from a JTextField
, use the
String getText()
method.
To put text into a JTextField
, use the
setText(String stuff)
method.
What type of listener is needed for an ActionEvent
?